import Vue from 'vue'
import Router from 'vue-router'

// const originalPush = Router.prototype.push
// Router.prototype.push = function push (location, onResolve, onReject) {
//   if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
//   return originalPush.call(this, location).catch(err => err)
// }
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect:'/home',
      component: () => import('./layout/index'),
      children: [
        {
          path: '/home',
          name: '主页',
          component: () => import('./pages/home/home')
        },
        {
          path: 'aboutUs',
          name: '关于我们',
          redirect:'./aboutUs/Introduction',
          component: () => import('./pages/aboutUs/aboutUs'),
          children:[
            {
              path: 'Introduction',
              name: '公司介绍',
              component: () => import('./pages/aboutUs/Introduction')
            },
            {
              path: 'vision',
              name: '企业愿景',
              component: () => import('./pages/aboutUs/vision')
            },
            {
              path: 'course',
              name: '公司历程',
              component: () => import('./pages/aboutUs/course')
            },
            {
              path: 'case',
              name: '案例库',
              component: () => import('./pages/aboutUs/case')
            },
            {
              path: 'news',
              name: '平台新闻',
              component: () => import('./pages/aboutUs/news')
            },
            {
              path: 'about',
              name: '联系我们',
              component: () => import('./pages/aboutUs/about')
            },
          ]
        }
      ]
    }
  ]
})
